import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name:'login',
    component: () => import("../views/Login.vue")
  },
  {
    path:'*',
    redirect:'/index',
  },
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect:'/index',
    children:[
      {
        path:'index',
        name: 'index',
        component:() => import("@/views/Index.vue")
      },
      {
        path: 'about',
        name: 'About',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
      },
      {
        path: 'user',
        name: 'user',
        component:() => import("@/views/User.vue")
      },
      {
        path: 'room',
        name: 'room',
        component:() => import("@/views/Room.vue")
      },
      {
        path:'config',
        name:'config',
        component:()=> import("@/views/Config.vue")
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
